<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<script src="/zj125/Public/Admin/Js/jquery.js"></script>
<script src="/zj125/Public/Admin/Js/jquery-ui-1.12.0.custom/jquery-ui.min.js"></script>
<link rel="stylesheet" href="/zj125/Public/Admin/Js/jquery-ui-1.12.0.custom/jquery-ui.min.css">
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
	.msg{width:150px;height:50px;background-color: red;display:none;}
	</style>
</head>
<body>
<div class="msg"></div>
<table border=1>
	<tr>
 		<td>ID</td>
 		<td>热销</td>
 		<td>团购</td>
 		<td>劲爆</td>
 		<td>现货</td>
 		<td>福利</td>
 		<td>操作</td>
	</tr>

	<?php if(is_array($arr)): foreach($arr as $key=>$vo): ?><tr id="user_<?php echo ($vo["ann_id"]); ?>">
 		<td><?php echo ($vo["ann_id"]); ?></td>
 		<td><?php echo ($vo["ann_sell"]); ?></td>
 		<td><?php echo ($vo["ann_group"]); ?></td>
 		<td><?php echo ($vo["ann_best"]); ?></td>
 		<td><?php echo ($vo["ann_cash"]); ?></td>
 		<td><?php echo ($vo["ann_weal"]); ?></td>
 		<td>
 		<a href="<?php echo U('Ann/edit');?>?uid=<?php echo ($vo["ann_id"]); ?>"><input type="button" value="编辑"></a>
 		<input data-uid="<?php echo ($vo['ann_id']); ?>" type="button" name="shanchu" value="删除">
 		</td>
	</tr><?php endforeach; endif; ?>
	<a href="<?php echo U('Ann/add');?>"><input type="button" value="添加"></a>
</table>

	<script>
  	$( function() {
  	$('[name="shanchu"]').click(function(){
  		var uid=$(this).attr("data-uid");
    $( "<div>是否确认删除</div>" ).dialog({
      resizable: false,
      title:"删除",
      height: "auto",
      width: 400,
      modal: true,
      buttons: {
			"确认删除": function() {
			  $( this ).dialog( "close" );
			  $.get('<?php echo U("del");?>',{uid:uid},function(data){
			if(data.status){				
				$('#user_'+uid).remove();
			}else{
				$('#user_'+uid+' [name="shanchu"]').val('删除');
				}			
			},'json');
			},
			"取消": function() {
			  $( this ).dialog( "close" );
			}
		  }
		});
	});
  });
  </script>
</body>
</html>